!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.mexp=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g"+b.value+""+e[f].show+""+a.value+"",type:10}):d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+""+a.value+"",type:1})):2===e[f].type||9===e[f].type?(a=d.pop(),b=d.pop(),d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+e[f].show+(1!=a.type?"(":"")+a.value+(1!=a.type?")":""),type:e[f].type})):12===e[f].type&&(a=d.pop(),b=d.pop(),c=d.pop(),d.push({value:e[f].show+"("+c.value+","+b.value+","+a.value+")",type:12}));return d[0].value},b.exports=d},{"./postfix_evaluator.js":5}],2:[function(a,b,c){function d(a,b){for(var c=0;cs.length-2?s.length-1:x.length-i;t>0;t--)for(u=0;uc)h.push(a);else{for(;c>=e&&!k||k&&e1)throw new d.exception("Uncaught Syntax error");return f[0].value>1e15?"Infinity":parseFloat(f[0].value.toFixed(15))},d.eval=function(a,b,c){return"undefined"==typeof b?this.lex(a).toPostfix().postfixEval():"undefined"==typeof c?"undefined"!=typeof b.length?this.lex(a,b).toPostfix().postfixEval():this.lex(a).toPostfix().postfixEval(b):this.lex(a,b).toPostfix().postfixEval(c)},b.exports=d},{"./postfix.js":4}]},{},[1])(1)});jQuery(document).ready(function($){if($(".wpcf7-form").length){cf7_formulas();$("body").on("change",".wpcf7 input,.wpcf7 select,.wpcf7 textarea",function(e){cf7_formulas()}) $(".cf7-hide").closest('p').css('display','none');function cf7_formulas(){var total=0;var match;var max=100;var reg=[];$("form.wpcf7-form input").each(function(){if($(this).attr("type")=="checkbox"||$(this).attr("type")=="radio"){var name=$(this).attr("name").replace("[]","");reg.push(name)}else{reg.push($(this).attr("name"))}}) $("form.wpcf7-form select").each(function(){reg.push($(this).attr("name"))}) reg=remove_duplicates_ctf7(reg);var field_regexp=new RegExp('('+reg.join("|")+')');$(".ctf7-total").each(function(index){var eq=$(this).data('formulas');console.log("eq"+eq);eq='('+eq+')';console.log(eq);while(match=field_regexp.exec(eq)){console.log("match"+match);var type=$("input[name="+match[0]+"]").attr("type");if(type===undefined){var type=$("input[name='"+match[0]+"[]']").attr("type")} if(type=="checkbox"){var vl=0;$("input[name='"+match[0]+"[]']:checked").each(function(){vl+=new Number($(this).val())});$("input[name='"+match[0]+"']:checked").each(function(){vl+=new Number($(this).val())})}else if(type=="radio"){var vl=$("input[name='"+match[0]+"']:checked").val()}else if(type=="date"){var myDate=$("input[name="+match[0]+"]").val();myDate=myDate.split("-");var newDate=myDate[1]+"/"+myDate[0]+"/"+myDate[2];var vl=new Date(myDate[0],myDate[1],myDate[2]).getTime()/(24*60*60*1000)}else if(type===undefined){var vl=$("select[name="+match[0]+"]").val();var n=vl.search(/\|/i);if(n>0){var vls=vl.split("|");vl=vls[0]}else{}}else{if($("input[name="+match[0]+"]").hasClass("ctf7-total")){var vl=$("input[name="+match[0]+"]").attr("data-number")}else{var vl=$("input[name="+match[0]+"]").val()}} if(!$.isNumeric(vl)){vl=0} console.log(vl);var reg_inner=new RegExp(match[0]+"(?!\\d)");eq=eq.replace(reg_inner,vl)} try{var r=mexp.eval(eq);total=r}catch(e){alert("Error:"+eq)} $(this).attr("data-number",total);total=cf7_format(total);$(this).val(total);$(this).parent().find('.cf7-calculated-name').html(total)})}} function cf7_format(number){var enable=$("#cf7-calculator-enable").val();if(enable=="yes"){var decimals=$("#cf7-calculator-decimals").val();var decPoint=$("#cf7-calculator-separator").val();var thousandsSep=$("#cf7-calculator-thousand").val();number=(number+'').replace(/[^0-9+\-Ee.]/g,'') var n=!isFinite(+number)?0:+number var prec=!isFinite(+decimals)?0:Math.abs(decimals) var sep=(typeof thousandsSep==='undefined')?',':thousandsSep var dec=(typeof decPoint==='undefined')?'.':decPoint var s='' var toFixedFix=function(n,prec){var k=Math.pow(10,prec) return''+(Math.round(n*k)/k).toFixed(prec)} s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.');if(s[0].length>3){s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep)} if((s[1]||'').length